#include "udpserver.hpp"
#include <memory>


std::string defaulthandler(const std::string &message)
{
    std::string hello = "hello, ";
    hello += message;
    return hello;
}

//端口号以命令行参数的形式获取
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " port" << std::endl;
        return 1;
    }
    uint16_t port = std::stoi(argv[1]);


    std::unique_ptr<udpserver> usvr = std::make_unique<udpserver>(port,defaulthandler);
    usvr->init();
    usvr->start();

    return 0;
}